package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.NursingPlanDto;
import com.zzyl.entity.NursingPlan;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NursingPlanMapper {

    Page<List<NursingPlan>> selectByPage(Integer pageNum, Integer pageSize, String name, Integer status);

    @Select(value = "select count(*) from nursing_plan where plan_name=#{planName}")
    int countByName(NursingPlan nursingPlan);

    void insertNursingPlan(NursingPlan nursingPlan);

    NursingPlanVo getById(Long id);

    @Select(value = "select count(*) from nursing_plan where id=#{id}")
    int countById(Long id);

    int deleteById(Long id);

    void updateNursingPlan(NursingPlan nursingPlan);

    @Update("update nursing_plan set status=(1-status) where id=#{id}")
    void alterStatus(Long id, Integer status);

    List<NursingPlanVo> listAll();

    @Select(value = "select status from nursing_plan where id = #{id}")
    int getStatus(Long id);
}
